package com.hamishmedlin.psxpw;

import static org.junit.Assert.*;

import org.junit.Test;

public class EncoderTest {

	@Test
	public void defaultSettings() {
		FormData fd = new FormData();
		
		String pw = QEncoder.encodePassword(fd);
		
		assertEquals("VBVXVVXVVV", pw);
	}
	
	@Test
	public void everything() {
		FormData fd = new FormData();
		
		for(String weapon : QGlobals.weaponControlForIndex){
			fd.setChecked(weapon, true);
		}
		fd.setChecked(QGlobals.BACKPACK, true);
		fd.setArmor(200);
		fd.setArmorType(QGlobals.ARMOR_BLUE);
		fd.setHealth(200);
		fd.setCell(600);
		fd.setClip(400);
		fd.setShell(100);
		fd.setRockets(100);
		String pw = QEncoder.encodePassword(fd);
		
		assertEquals("M51W3PRCPM", pw);
	}

	@Test
	public void levelSkillArmor(){
		FormData fd = new FormData();
		fd.setNextMap(59);
		fd.setGameSkil(QGlobals.SKILL_ULTRA);
		fd.setArmorType(QGlobals.ARMOR_GREEN);
		fd.setArmor(50);
		String pw = QEncoder.encodePassword(fd);
		
		assertEquals("!9DBDDBBFD", pw);
	}
}
